package com.tbvtc.agriculturalcreditchainserver2025.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tbvtc.agriculturalcreditchainserver2025.entity.Addess.Area;
import com.tbvtc.agriculturalcreditchainserver2025.mapper.AddressMapper;
import com.tbvtc.agriculturalcreditchainserver2025.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressMapper addressMapper;
    @Cacheable(cacheNames = "area", key = "#pid") //
    public List<Area> checkProvincesMunicipalities(Long pid) {
//        return addressMapper.selectList(new LambdaQueryWrapper<Area>().eq(Area::getParentId, pid));
        return addressMapper.selectList(pid);
    }


}
